package com.ruoyi.factorydata.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.factorydata.mapper.CraftProcessRelationMapper;
import com.ruoyi.factorydata.domain.CraftProcessRelation;
import com.ruoyi.factorydata.service.ICraftProcessRelationService;

/**
 * 工艺工序Service业务层处理
 *
 * @author ruoyi
 * @date 2025-07-15
 */
@Service
public class CraftProcessRelationServiceImpl extends ServiceImpl<CraftProcessRelationMapper, CraftProcessRelation> implements ICraftProcessRelationService {
    @Autowired
    private CraftProcessRelationMapper craftProcessRelationMapper;

    /**
     * 查询工艺工序
     *
     * @param id 工艺工序主键
     * @return 工艺工序
     */
    @Override
    public CraftProcessRelation selectCraftProcessRelationById(Long id) {
        return craftProcessRelationMapper.selectCraftProcessRelationById(id);
    }

    /**
     * 查询工艺工序列表
     *
     * @param craftProcessRelation 工艺工序
     * @return 工艺工序
     */
    @Override
    public List<CraftProcessRelation> selectCraftProcessRelationList(CraftProcessRelation craftProcessRelation) {
        return craftProcessRelationMapper.selectCraftProcessRelationList(craftProcessRelation);
    }

    /**
     * 新增工艺工序
     *
     * @param craftProcessRelation 工艺工序
     * @return 结果
     */
    @Override
    public int insertCraftProcessRelation(CraftProcessRelation craftProcessRelation) {
                craftProcessRelation.setCreateTime(DateUtils.getNowDate());
            return craftProcessRelationMapper.insertCraftProcessRelation(craftProcessRelation);
    }

    /**
     * 修改工艺工序
     *
     * @param craftProcessRelation 工艺工序
     * @return 结果
     */
    @Override
    public int updateCraftProcessRelation(CraftProcessRelation craftProcessRelation) {
                craftProcessRelation.setUpdateTime(DateUtils.getNowDate());
        return craftProcessRelationMapper.updateCraftProcessRelation(craftProcessRelation);
    }

    /**
     * 批量删除工艺工序
     *
     * @param ids 需要删除的工艺工序主键
     * @return 结果
     */
    @Override
    public int deleteCraftProcessRelationByIds(Long[] ids) {
        return craftProcessRelationMapper.deleteCraftProcessRelationByIds(ids);
    }

    /**
     * 删除工艺工序信息
     *
     * @param id 工艺工序主键
     * @return 结果
     */
    @Override
    public int deleteCraftProcessRelationById(Long id) {
        return craftProcessRelationMapper.deleteCraftProcessRelationById(id);
    }
}